﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Store. </summary>
	public partial class StoreRelations
	{
		/// <summary>CTor</summary>
		public StoreRelations()
		{
		}

		/// <summary>Gets all relations of the StoreEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.InitialBalanceEntityUsingStoreId);
			toReturn.Add(this.ShelfEntityUsingStoreId);
			toReturn.Add(this.StorekeeperEntityUsingStoreId);
			toReturn.Add(this.StoreShelfBalanceEntityUsingStoreId);
			toReturn.Add(this.TransactionItemEntityUsingStoreId);
			toReturn.Add(this.TransferRequestEntityUsingFromStoreId);
			toReturn.Add(this.TransferRequestEntityUsingToStoreId);
			toReturn.Add(this.TransferTransactionEntityUsingToStoreId);
			toReturn.Add(this.TransferTransactionEntityUsingFromStoreId);
			toReturn.Add(this.ProjectEntityUsingProjectId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and InitialBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - InitialBalance.StoreId
		/// </summary>
		public virtual IEntityRelation InitialBalanceEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "InitialBalances" , true);
				relation.AddEntityFieldPair(StoreFields.Id, InitialBalanceFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("InitialBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and ShelfEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - Shelf.StoreId
		/// </summary>
		public virtual IEntityRelation ShelfEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Shelves" , true);
				relation.AddEntityFieldPair(StoreFields.Id, ShelfFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and StorekeeperEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - Storekeeper.StoreId
		/// </summary>
		public virtual IEntityRelation StorekeeperEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Storekeepers" , true);
				relation.AddEntityFieldPair(StoreFields.Id, StorekeeperFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StorekeeperEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and StoreShelfBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - StoreShelfBalance.StoreId
		/// </summary>
		public virtual IEntityRelation StoreShelfBalanceEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "StoreShelfBalances" , true);
				relation.AddEntityFieldPair(StoreFields.Id, StoreShelfBalanceFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreShelfBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and TransactionItemEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - TransactionItem.StoreId
		/// </summary>
		public virtual IEntityRelation TransactionItemEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransactionItems" , true);
				relation.AddEntityFieldPair(StoreFields.Id, TransactionItemFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and TransferRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - TransferRequest.FromStoreId
		/// </summary>
		public virtual IEntityRelation TransferRequestEntityUsingFromStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferRequests" , true);
				relation.AddEntityFieldPair(StoreFields.Id, TransferRequestFields.FromStoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferRequestEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and TransferRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - TransferRequest.ToStoreId
		/// </summary>
		public virtual IEntityRelation TransferRequestEntityUsingToStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferRequests_" , true);
				relation.AddEntityFieldPair(StoreFields.Id, TransferRequestFields.ToStoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferRequestEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and TransferTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - TransferTransaction.ToStoreId
		/// </summary>
		public virtual IEntityRelation TransferTransactionEntityUsingToStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferTransactions" , true);
				relation.AddEntityFieldPair(StoreFields.Id, TransferTransactionFields.ToStoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferTransactionEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between StoreEntity and TransferTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Store.Id - TransferTransaction.FromStoreId
		/// </summary>
		public virtual IEntityRelation TransferTransactionEntityUsingFromStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferTransactions_" , true);
				relation.AddEntityFieldPair(StoreFields.Id, TransferTransactionFields.FromStoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferTransactionEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between StoreEntity and ProjectEntity over the m:1 relation they have, using the relation between the fields:
		/// Store.ProjectId - Project.Id
		/// </summary>
		public virtual IEntityRelation ProjectEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Project", false);
				relation.AddEntityFieldPair(ProjectFields.Id, StoreFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticStoreRelations
	{
		internal static readonly IEntityRelation InitialBalanceEntityUsingStoreIdStatic = new StoreRelations().InitialBalanceEntityUsingStoreId;
		internal static readonly IEntityRelation ShelfEntityUsingStoreIdStatic = new StoreRelations().ShelfEntityUsingStoreId;
		internal static readonly IEntityRelation StorekeeperEntityUsingStoreIdStatic = new StoreRelations().StorekeeperEntityUsingStoreId;
		internal static readonly IEntityRelation StoreShelfBalanceEntityUsingStoreIdStatic = new StoreRelations().StoreShelfBalanceEntityUsingStoreId;
		internal static readonly IEntityRelation TransactionItemEntityUsingStoreIdStatic = new StoreRelations().TransactionItemEntityUsingStoreId;
		internal static readonly IEntityRelation TransferRequestEntityUsingFromStoreIdStatic = new StoreRelations().TransferRequestEntityUsingFromStoreId;
		internal static readonly IEntityRelation TransferRequestEntityUsingToStoreIdStatic = new StoreRelations().TransferRequestEntityUsingToStoreId;
		internal static readonly IEntityRelation TransferTransactionEntityUsingToStoreIdStatic = new StoreRelations().TransferTransactionEntityUsingToStoreId;
		internal static readonly IEntityRelation TransferTransactionEntityUsingFromStoreIdStatic = new StoreRelations().TransferTransactionEntityUsingFromStoreId;
		internal static readonly IEntityRelation ProjectEntityUsingProjectIdStatic = new StoreRelations().ProjectEntityUsingProjectId;

		/// <summary>CTor</summary>
		static StaticStoreRelations()
		{
		}
	}
}
